package com.alibaba.citrus.cr.mn.order.center.common.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 客户中心配置
 */
@Getter
public enum CustomerCenterConfigEnum {
    CUSTOMER_TYPE("customerType", "客户类别"),
    APPELLATION("appellation", "称谓"),
    PROVINCE("province", "地区"),
    COUNTRY("country", "国家"),
    LANGUAGE("language", "语言"),
    INVOICING_TYPE("invoicingType", "开票类型"),
    TRADE_PARTNERS("tradePartners", "贸易伙伴"),
    SUPPLIER("supplier", "供应商"),
    SALES_ORGANIZATION("salesOrganization", "销售组织"),
    SALES_CHANNEL("salesChannel", "分销渠道"),
    PRODUCT_GROUP("productGroup", "产品组"),
    SALES_DISTRICT("salesDistrict", "销售地区"),
    SALES_OFFICE("salesOffice", "销售办公室"), // 销售渠道
    SALES_GROUP("salesGroup", "销售组"), // 销售部门
    CUSTOMER_GROUP("customerGroup", "客户组"),
    CURRENCY("currency", "货币"),
    PRICE_GROUP("priceGroup", "价格组"),
    CUSTOMER_PRICING_PROCESS("customerPricingProcess", "客户定价过程"),
    CUSTOMER_STATISTICS_GROUP("customerStatisticsGroup", "客户统计组"),
    DELIVERY_PRIORITY("deliveryPriority", "交货优先级"),
    SHIPPING_CONDITION("shippingCondition", "装运条件"),
    EACH_PARTIAL_DELIVERY("eachPartialDelivery", "每个项目的部分交货"),
    CREDIT_CONTROL_SCOPE("creditControlScope", "信贷控制范围"),
    TAX_CLASSIFICATION("taxClassification", "税分类"),
    CUSTOMER_FREEZE("customerFreeze", "客户冻结标识"),
    DELIVERY_FREEZE("deliveryFreeze", "交货冻结"),
    CUSTOMER_GROUP_1("customerGroup1", "客户组1"),
    CUSTOMER_GROUP_3("customerGroup3", "客户组3"),
    CUSTOMER_GROUP_4("customerGroup4", "客户组4"),
    CUSTOMER_GROUP_5("customerGroup5", "客户组5"),
    CITY_LEVEL("cityLevel", "城市级别"),
    MAIN_FRANCHISE_SITUATION("mainFranchiseSituation", "主专营情况"),
    DEALER_BUSINESS_MODEL("dealerBusinessModel", "经销商业务模式"),
    RTM_MODEL("RTMmodel", "RTM模式"),
    BUSINESS_CATEGORY("customerBusinessCategory", "客户经营品类"),
    COMPANY("company", "公司"),
    SORT("sort", "排序码"),
    PAYMENT_TERM("paymentTerm", "付款条件"),
    FIRST_SCENARIO("firstScenario", "一级场景"),
    SECOND_SCENARIO("secondScenario", "二级场景"),
    CROSS_REGION_SALE_LEVEL("crossRegionSaleLevel", "窜货等级"),
    FIRST_CHANNEL("firstChannel", "一级渠道类型"),
    BUSINESS_MOEL("businessModel", "经营模式"),
    WAREHOUSE_PROPERTIES("warehouseProperties", "库房属性"),
    STOP_MARKING("stopMarking", "停做标记"),
    CUSTOMER_LEVEL("customerLevel", "客户层级"),
    PARTNER_FUNCTIONALITY("partnerFunctionality", "合作伙伴功能"),
    CUSTOMER_PRIORITY("customerPriority", "ABC等级"),
    MBU_OR_COOPERATIVE("mbuOrCooperative", "是否MBU/合作社客户"),
    TRANSPORTATION_AREA("transportationArea", "运输区域"),
    DELIVERY_FACTORY("deliveryFactory", "交货工厂"),
    RECONCILIATION_ACCOUNT("reconciliationAccount", "统驭科目"),
    BANK("bank", "银行");

    private final String code;
    private final String desc;

    CustomerCenterConfigEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static CustomerCenterConfigEnum of(String code) {
        return Arrays.stream(CustomerCenterConfigEnum.values()).filter(source -> Objects.equals(code, source.getCode())).findFirst().orElse(null);
    }

}
